﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Motoball;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Motoball.screenmanager;

namespace Motoball.screens
{
    public class MainMenuScreen : MenuScreen
    {
        public MainMenuScreen(string screenName)
            : base(screenName)
        {
        }

        

        #region Methods
        public override void LoadContent()
        {
            ContentManager content = screenManager.Content;
            AddItem(new MenuItem(new BasicModel(content.Load<Model>("Models\\Singleplayer"))));
            AddItem(new MenuItem(new BasicModel(content.Load<Model>("Models\\Multiplayer"))));
            AddItem(new MenuItem(new BasicModel(content.Load<Model>("Models\\Credits"))));
            AddItem(new MenuItem(new BasicModel(content.Load<Model>("Models\\Instructions"))));
            AddItem(new MenuItem(new BasicModel(content.Load<Model>("Models\\ResetProfile"))));
            AddItem(new MenuItem(new BasicModel(content.Load<Model>("Models\\Exit"))));
            
            float colorValue = 0.7f;
            //singleplayer-paddle
            BasicModel model = items[0].model;
            model.diffColors["Chassie"] = new Vector3(colorValue,0,0);
            model.diffColors["Reifen1"] = new Vector3(0.2f);
            model.diffColors["Reifen2"] = new Vector3(0.2f);
            
            //multiplayer-paddle
            model = items[1].model;
            model.diffColors["Cassie1"] = new Vector3(colorValue,0,0);
            model.diffColors["Chassie2"] = new Vector3(0,0,colorValue);
            model.diffColors["Rad1"] = new Vector3(0.2f);
            model.diffColors["Rad2"] = new Vector3(0.2f);
            model.diffColors["Rad3"] = new Vector3(0.2f);
            model.diffColors["Rad4"] = new Vector3(0.2f);

            //credits-stars: yellow
            model = items[2].model;
            model.diffColors["<<<<<<<<stern1"] = new Vector3(colorValue, colorValue, 0);
            model.diffColors["Stern2"] = new Vector3(colorValue, colorValue, 0);
            model.diffColors["Stern3"] = new Vector3(colorValue, colorValue, 0);

            //instructions
            model = items[3].model;
            model.diffColors["Brille"] = new Vector3(0.33f,0.166f,0);
            model.diffColors["Augenbraue1"] = new Vector3(0.066f, 0.0086f, 0);
            model.diffColors["Augenbraue2"] = new Vector3(0.066f, 0.0086f, 0); 
            model.diffColors["Pupille2"] = new Vector3(0.2f,0.2f,0.5f);
            model.diffColors["Pupille1"] = new Vector3(0.2f, 0.2f, 0.5f);

            //reset
            model = items[4].model;
            model.diffColors["Pacman"] = new Vector3(colorValue, colorValue, 0);

            //Exit
            model = items[5].model;
            model.diffColors["Tuer"] = new Vector3(0, colorValue/2f, 0);
            model.diffColors["Mann_Kopf"] = Vector3.One * 2f;
            model.diffColors["Mann_Körper"] = Vector3.One * 2f;
            model.diffColors["Pfeil"] = Vector3.One * 2f;
           
            TopItem = 0;
            
            Reset();
        }
        protected override void SelectEntry()
        {
            switch (TopItem)
            {
                //sp
                case 0:
                    SingleplayerGameplayScreen singleplayer = (SingleplayerGameplayScreen)
                        screenManager.GetScreen("singleplayerGameplayScreen");
                    screenManager.gameplayPointer = singleplayer;
                    PaddleSelectionScreen selection = (PaddleSelectionScreen)screenManager.
                        GetScreen("paddleSelectionScreen");
                    selection.CurrentPlayerSelecting = 0;
                    break;
                //mp
                case 1:
                    MultiplayerGameplayScreen multiplayer = (MultiplayerGameplayScreen)
                        screenManager.GetScreen("multiplayerGameplayScreen");
                    screenManager.gameplayPointer = multiplayer;
                    PaddleSelectionScreen selection2 = (PaddleSelectionScreen)screenManager.
                        GetScreen("paddleSelectionScreen");
                    selection2.CurrentPlayerSelecting = 0;
                    break;
                case 5:
                    screenState = ScreenState.Exiting;
                    return;
                default:
                    break;
            }
            base.SelectEntry();
        }
        #endregion
    }
}
